package com.yanqu.road.server.logic.bag;

import com.yanqu.road.entity.bag.UseGoodsResult;
import com.yanqu.road.entity.config.goods.GoodsInfo;
import com.yanqu.road.entity.config.goods.OpenGoodsBagResult;
import com.yanqu.road.entity.enums.eLogMoneyType;
import com.yanqu.road.entity.enums.eMessageType;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.CurrencyModule;
import com.yanqu.road.server.manger.config.GoodsBagMgr;
import com.yanqu.road.server.manger.player.WorldMessageMgr;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;

/**
 * 使用平台道具
 */
public class UsePlatformGoods extends BaseUseGoods {

	public UsePlatformGoods(GamePlayer player, GoodsInfo goodsInfo, long param) {
		super(player, goodsInfo, param);
	}

	@Override
	int checkUse(long count) {
		return 0;
	}

	@Override
	UseGoodsResult executeUse(long count) {
		UseGoodsResult result = new UseGoodsResult();
		Property reward = PropertyHelper.parseStringToProperty(goodsInfo.getExtendParam());
		reward.rideProperty(count);

		player.getModule(CurrencyModule.class).addCurrency(reward, eLogMoneyType.Bag, eLogMoneyType.UsePlatformGoods);
		result.setReward(PropertyHelper.parsePropertyToString(reward));
		return result;
	}
}
